/*
 * @Author: your name
 * @Date: 2020-12-09 09:52:42
 * @LastEditTime: 2021-03-27 10:45:02
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \jun-bang-sheng-chan-guan-li-xi-tong\src\router\index.js
 */
import Vue from "vue";
import Router from "vue-router";
// import {createWebHistory} from 'vue-router'
// import Login from "@/views/login/Login.vue"; // Login 登录页

import GetToken from '@/views/GetToken'
import Handler from '@/views/Handler'
import Bind from '../views/Bind.vue'
import UnBind from '../views/UnBind.vue'

Vue.use(Router);

// 配置项目中没有涉及权限的公共路由
// 这部分所有人都可以进行相应跳转
// 公共路由:登录路由|用户首页路由

const constantRoutes = [
    {
        path: "/login",
        component: () => import("@/views/login/Login")
    },
    {
        path: "/",
        name: "首页",
        component: () => import("@/layouts/TabsView"),
        redirect: "/home",
        children: [

            {
                // 用户首页面
                path: "/home", // 路径
                name: "用户首页", // 路径名
                meta: {
                    icon: "user", // 设置小图标
                },
                // 渲染组件
                component: () => import("@/views/home/Home.vue"),
            },
            //  -------------- 所有的异常页 -----------------
            {
                // 错误 404
                path: "/NoExistent", // 路径
                name: "页面不存在", // 路径名
                meta: {
                    icon: "error", // 设置小图标
                },
                // 渲染组件
                component: () => import("@/pages/exception/404.vue"),
            },
            {
                // 错误 404
                path: "/ServerError", // 路径
                name: "服务器异常", // 路径名
                meta: {
                    icon: "error", // 设置小图标
                },
                // 渲染组件
                component: () => import("@/pages/exception/500.vue"),
            },
            {
                // 错误 403
                path: "/NoPermission", // 路径
                name: "无权访问", // 路径名
                meta: {
                    icon: "error", // 设置小图标
                },
                // 渲染组件
                component: () => import("@/pages/exception/403.vue"),
            },
        ],
    },
    {
        path: "/personalCenter",
        component: () => import("@/views/personalCenter/index"),
        hidden: true,
    },
    {
        path: '/getToken',
        name: 'GetTohen',
        component: GetToken
      },
      {
        path: '/handler',
        name: 'Hadler',
        component: Handler
      },
      {
        path: '/bind',
        name: 'Bind',
        component: Bind
      },
      {
        path: '/unbind',
        name: 'UnBind',
        component: UnBind
      }

];

let router = new Router({
    routes: constantRoutes,
    mode: 'history',//在路由中不加#
    base:  '/wechat/'//添加基础路由，对用nginx配置中的 location /wechat/
});
export default router;

